﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BUS;
using DataTransfer;
namespace Gui
{
    public partial class frmLapHoaDon : DevComponents.DotNetBar.Office2007Form
    {
        frmMain frm_main;
        BenhNhan bn;
        HoaDonBus hoadonBus;
        public frmLapHoaDon(BenhNhan info,frmMain frm)
        {
            bn = info;
            frm_main = frm;
            InitializeComponent();
        }

        private void btnThoat_Click(object sender, EventArgs e)
        {
            this.Close();
        }
        public void load()
        {
            hoadonBus = new HoaDonBus();
            double tienkham=hoadonBus.GetTienKham();
            double tienthuoc= hoadonBus.GetTienThuoc(bn);
            double thanhtien=tienkham+tienthuoc;
            txtTienKham.Text = tienkham.ToString();
            txtTienThuoc.Text =tienthuoc.ToString();
            txtThanhTien.Text = thanhtien.ToString();
            txtMaBenhNhan.Text = bn.ID.ToString();
            txtNgayKham.Text = bn.NgayKham.ToString();
            txtHoTen.Text = bn.HoTen.ToString();

        }

        private void btnThanhToan_Click(object sender, EventArgs e)
        {
            hoadonBus.LapHoaDon(bn, frmMain.currentUser);
            MessageBox.Show("Thanh toan Success");
            this.Close();
        }

        private void frmLapHoaDon_Load(object sender, EventArgs e)
        {
            load();

        }

       
    }
}
